

package com.atom.module.image.filter;


public class PosterizeFilter extends LUTFilter {

    public int _level;

    public int InitLUTtable(int LUTIndex) {
        double d = 255.0 / (_level - 1.0);
        int n = (int) (LUTIndex / d + 0.5); // round
        return Function.FClamp0255(d * n); // round
    }

    public PosterizeFilter(int nLevel) {
        _level = (Math.max(nLevel, 2));
    }
}
